/**
 * Created by mxk on 2017/8/7.
 */

/**
 * Created by mxk on 2017/8/7.
 */
//登陆接口
function UserLogin(){
    //api/user/loginuser?phone=13413950591&password=000000&loginapp=4
    $.ajax({
        type: 'POST',
        url: 'api/user/loginuser',
        data: { phone: 'Zepto.js',password:'',regapp:6},
        dataType: 'json',
        timeout: 300,
        success: function(data){
            // Supposing this JSON payload was received:
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}
//第三方登陆接口
function OpendIdLogin() {
    ///api/user/loginbyopenid?type=4&openid=1111111111&nick=mxk1&photo=&regapp=4
    $.ajax({
        type: 'POST',
        url: '/api/user/reguser',
        data: { type:4,openid: 'Zepto.js',nick:'',photo:'' ,regapp:6},
        dataType: 'json',
        timeout: 300,
        success: function(data){

        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}
//用户注册接口
function UserReg() {
    ///api/user/reguser?phone=13413950591&phoneSN=test1111&password=000000&code=0000&regapp=4
    $.ajax({
        type: 'POST',
        url: '/api/user/reguser',
        data: { phone: 'Zepto.js',phoneSN:'',password:'',code:'' ,regapp:6},
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}
//获取用户信息
function GetUserInfo() {
    ///api/user/reguser?phone=13413950591&phoneSN=test1111&password=000000&code=0000&regapp=4
    $.ajax({
        type: 'GET',
        url: '/api/user/getuserinfo',
        data: { phone: 'Zepto.js',phoneSN:'',password:'',code:'' ,regapp:6},
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}
//修改用户名称
function UpdateUserName() {
    ///api/user/reguser?phone=13413950591&phoneSN=test1111&password=000000&code=0000&regapp=4
    $.ajax({
        type: 'POST',
        data:{userName:''},
        url: '/api/user/updateusername',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}
//修改用户 信息
function UpdateUserInfo() {
    //api/user/updateuserinfo?sex=男&introduction=爬山&brithday=2014-01-02
    $.ajax({
        type: 'POST',
        url: '/api/user/updateuserinfo',
        data:{sex:'',introduction:'',brithday:'2014-01-02'},
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}
//修改头像### 需要修改
function UpdateUserPhoto(){

}
//推出登陆
function UserLoginOut(){
    $.ajax({
        type: 'POST',
        url: '/api/user/loginout',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}


//推出登陆
function UpdatePhone(){
    $.ajax({
        type: 'POST',
        url: '/api/user/updatephone',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}//


//##评论接口

//获取电影的评论
function GetCommentList(){
    $.ajax({
        type: 'GET',
        url: '/api/comment/getcommentlist?classtype=1&objectid=5930e4cd1c886e2dc0d45342&parentid=1&pno=1&pagesize=3&allcount=-1',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}


//##评论接口
function GetGetmyCommentList(){
    ///api/comment/getcommentlist?classtype=1&
    // objectid=5930e4cd1c886e2dc0d45342&parentid=1&pno=1&pagesize=3&allcount=-1
    $.ajax({
        type: 'GET',
        url: '/api/comment/getmyanswerlist?pno=1&pagesize=3&allcount=-1',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}
//获取我的评论列表
function GetMyAnswerList(){
    ///api/comment/getcommentlist?classtype=1&
    // objectid=5930e4cd1c886e2dc0d45342&parentid=1&pno=1&pagesize=3&allcount=-1
    $.ajax({
        type: 'GET',
        url: '/api/comment/getmyanswerlist?pno=1&pagesize=3&allcount=-1',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}

//获取我的回复

//点赞
function AddCommentGoodLog() {
    ///api/comment/getcommentlist?classtype=1&
    // objectid=5930e4cd1c886e2dc0d45342&parentid=1&pno=1&pagesize=3&allcount=-1
    $.ajax({
        type: 'POST',
        url: '/api/comment/addcommentgoodlog?commentid=1&apptype=3',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}

//添加举报
function AddCommenteprotlog() {
    ///api/comment/getcommentlist?classtype=1&
    // objectid=5930e4cd1c886e2dc0d45342&parentid=1&pno=1&pagesize=3&allcount=-1
    $.ajax({
        type: 'POST',
        url: '/api/comment/addcommentreprotlog?commentid=1&content=123123&apptype=3',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}

//添加举报
function DelCommente() {
    ///api/comment/getcommentlist?classtype=1&
    // objectid=5930e4cd1c886e2dc0d45342&parentid=1&pno=1&pagesize=3&allcount=-1
    $.ajax({
        type: 'POST',
        url: '/api/comment/delcomment?commentid=15',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}


//## 数值操作

function AddVideoClick(){
    $.ajax({
        type: 'POST',
        url: '/api/videocount/addlooklog?classtype=1&objectid=5930e4cd1c886e2dc0d45342&apptype=3',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}

function AddVideoGoodLog(){
    $.ajax({
        type: 'POST',
        url: '/api/videocount/addgoodlog?classtype=1&objectid=5930e4cd1c886e2dc0d45342&apptype=3',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}
//添加收藏
function AddCollectLog(){
    $.ajax({
        type: 'POST',
        url: '/api/videocount/addcollectlog',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}

function GetMyCollectLog() {
    ///api/comment/getcommentlist?classtype=1&
    // objectid=5930e4cd1c886e2dc0d45342&parentid=1&pno=1&pagesize=3&allcount=-1
    $.ajax({
        type: 'POST',
        url: '/api/videocount/getmyplaylog',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}

function DelCollectLog(){
    $.ajax({
        type: 'POST',
        url: '/api/videocount/delcollectlog',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}

function AddPalyLog(){
    $.ajax({
        type: 'POST',
        url: '/api/videocount/addplaylog',
        dataType: 'json',
        timeout: 300,
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}

function DelPalyLog() {
    ///api/comment/getcommentlist?classtype=1&
    // objectid=5930e4cd1c886e2dc0d45342&parentid=1&pno=1&pagesize=3&allcount=-1
    $.ajax({
        type: 'POST',
        url: '/api/videocount/delplaylog',
        dataType: 'json',
        success: function(data){
            this.append(data.project.html)
        },
        error: function(xhr, type){
            alert('Ajax error!')
        }
    });
}